/**
 * Copyright (c) 2023 myons Inc. All rights reserved.
 */
package cn.zmwh.common.security.pojo.request;

import cn.hutool.core.util.StrUtil;
import cn.zmwh.common.security.pojo.vo.WxDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @describe: 登录 、
 * @author: dmzmwh 、
 * @time: 2023-04-10 17:36 、
 */
@Data
public class LoginRequest implements Serializable {

    @ApiModelProperty(value = "手机号", required = true)
    private String mobile;
    @ApiModelProperty(value = "终端类型", required = true)
    private String terminal = "mini";
    @ApiModelProperty(value = "邮箱", required = true)
    private String email;
    @ApiModelProperty(value = "code 验证码")
    private String loginType;
    @ApiModelProperty(value = "验证码")
    private String code;
    @ApiModelProperty(value = "密码")
    private String password;
    @ApiModelProperty(value = "appId")
    private String appid = "wx228067cdf65b022d";


    /* 微信登录二次传 */
    @ApiModelProperty(value = "微信登录二次传 微信")
    private WxDTO wxDTO;


    /**
     * 获取用户名，优先取手机号
     *
     * @return
     */
    public String getUserName() {
        if (StrUtil.isNotEmpty(mobile)) {
            return mobile;
        }
        return email;
    }
}
